package yuan.deng.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yuan.deng.domain.Person;
import yuan.deng.service.PersonService;

/**
 * @Description:
 * @Version: V1.0
 */

@RestController
@RequestMapping("/personP")
public class PersoCnontroller {

    @Value("${server.port}")
    int port;

    @Autowired
    private PersonService personService;

    @GetMapping("/findById/{id}")
    public Person findById(@PathVariable("id")int id){
        //System.out.println(personService.findById(id));
        System.out.println(port);
        Person person = personService.findById(id);
        person.setAge(port);
        return person;
    }
}
